;===========================================================================
;Print screen utility to disk.
;===========================================================================

#short
#inpend=0

setint 5 to printscr
print bios "DSCR installed."
pokeb 0|500h,0
stop resident

;===========================================================================

buffer ? 25*82+1

printscr:
pushall
reg ds=reg cs
if peekb 0|500h then goto exitscr
video=0b800h-(800h*mono)+page*100h
pokeb 0|500h,1

m=0:b=buffer
repeat 25
    {
    ob=b
    repeat 80
	{
	c=video[m]b:if (c=0) or (c=255) then c=' '
	pokeb b,c
	b++:m+=2
	}
    while (b>ob) and (peekb(b-1)=' ')  b--

    pokeb b,13:b++
    pokeb b,10:b++
    }
pokeb b,26

oc=curpos
open window wname
cursor 20,28:inputs name
if peekb (name+2) then save name+2,buffer,b+1
close window
curpos=oc

pokeb 0|500h,0

exitscr:
popall
iret

wname:
datab 0,0,26,18,54,22,7,26

name:
string 26
